package com.geovis.emergency.spd.config;

import com.corundumstudio.socketio.SocketIOServer;
import com.geovis.common.socketio.service.ISocketIoService;
import com.geovis.emergency.spd.biz.zwdd.service.IZwddServcie;
import com.geovis.emergency.spd.redis.SpdRedis;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.context.annotation.Bean;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

/**
 * <p>
 * 服务成功加载完成后事件
 * </p>
 *
 * @author 王响
 * @since 2022-03-17
 */
@Component
@RequiredArgsConstructor
@Slf4j
public class ApplicationStartupRunner implements ApplicationRunner {

    private final IZwddServcie zwddServcie;

    private final ISocketIoService socketIoService;

    private final RedisTemplate redisTemplate;

    private final SocketIOServer socketIOServer;

    //注册redis
    @Bean
    public SpdRedis spdRedis(){
        return new SpdRedis(redisTemplate);
    }
    @Override
    public void run(ApplicationArguments args) throws Exception {
//        zwddServcie.registerListenerEvent();
    }

//    @Scheduled(cron="0/10 * * * * *")
//    public void getCount(){
//        socketIoService.sendMessage(SocketIoMessage.builder().data("你是谁啊").eventName("WX").toUserIdSet(CollUtil.set(false,"1520215084872249345")).build());
//    }
}